package com.example.vue_serve.controller;
import com.example.vue_serve.entity.TbUser;
import com.example.vue_serve.service.TbUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("user")
public class TbUserController {
    @Autowired
    private TbUserService tbUserService;
    @RequestMapping(value = "/findAll",method = RequestMethod.GET)
    public List<TbUser> findAll(){
        return tbUserService.findAll();

    }

    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public String add(@RequestBody TbUser user){
        return  tbUserService.add(user);
    }
}
